import 'package:xrenovation/utils/http.dart';

class ProjectApi {
  static Future<Map<String, dynamic>> addProject(
    Map<String, dynamic> data,
  ) async {
    final res = await Http.post('/project/add', data);
    return res.data;
  }

  static Future<Map<String, dynamic>> deleteProject(String id) async {
    final res = await Http.delete('/project/delete/$id', {});
    return res.data;
  }

  static Future<Map<String, dynamic>> getCurrencyUnits() async {
    final res = await Http.get('/project/unit/list');
    return res.data;
  }

  static Future<Map<String, dynamic>> getProjectList() async {
    final res = await Http.get('/project/list');
    return res.data;
  }

  static Future<Map<String, dynamic>> updateProject(
    Map<String, dynamic> data,
  ) async {
    final res = await Http.post('/project/update', data);
    return res.data;
  }
  
  static Future<Map<String, dynamic>> getProjectTasks(String projectId) async {
    final res = await Http.get('/task/list/$projectId');
    return res.data;
  }

  static Future<Map<String, dynamic>> getContractorList() async {
    final res = await Http.get('/contractor/list');
    return res.data;
  }

  static Future<Map<String, dynamic>> addTask(Map<String, dynamic> data) async {
    final res = await Http.post('/task/add', data);
    return res.data;
  }

  static Future<Map<String, dynamic>> deleteTask(String id) async {
    final res = await Http.delete('/task/delete/$id', {});
    return res.data;
  }

  static Future<Map<String, dynamic>> getTaskDetails(String taskId) async {
    final res = await Http.get('/task/get/$taskId');
    return res.data;
  }

  static Future<Map<String, dynamic>> updateTask(Map<String, dynamic> data) async {
    final res = await Http.post('/task/update', data);
    return res.data;
  }
}
